import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import { TextLoader } from "langchain/document_loaders/fs/text";

const loader = new TextLoader("data/test.js");

const docs = await loader.load();

const splitter = RecursiveCharacterTextSplitter.fromLanguage("js", {
  chunkSize: 320,
  chunkOverlap: 0,
});

const result = await splitter.splitDocuments(docs);

console.log(result);
